/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.mad.bikepony.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import com.mad.bikepony.model.Delivery;
import com.mad.bikepony.model.DeliveryModel;
import com.mad.bikepony.model.DeliverySoap;

import java.io.Serializable;

import java.sql.Types;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * The base model implementation for the Delivery service. Represents a row in the &quot;bp_delivery&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.mad.bikepony.model.DeliveryModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DeliveryImpl}.
 * </p>
 *
 * @author nicola
 * @see DeliveryImpl
 * @see com.mad.bikepony.model.Delivery
 * @see com.mad.bikepony.model.DeliveryModel
 * @generated
 */
@JSON(strict = true)
public class DeliveryModelImpl extends BaseModelImpl<Delivery>
	implements DeliveryModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a delivery model instance should use the {@link com.mad.bikepony.model.Delivery} interface instead.
	 */
	public static final String TABLE_NAME = "bp_delivery";
	public static final Object[][] TABLE_COLUMNS = {
			{ "deliveryId", Types.BIGINT },
			{ "deliveryCode", Types.VARCHAR },
			{ "trackingCode", Types.VARCHAR },
			{ "senderAddress", Types.VARCHAR },
			{ "senderAdditionalInfo", Types.VARCHAR },
			{ "senderEmail", Types.VARCHAR },
			{ "recipientAddress", Types.VARCHAR },
			{ "recipientAdditionalInfo", Types.VARCHAR },
			{ "recipientEmail", Types.VARCHAR },
			{ "state_", Types.INTEGER },
			{ "agentId", Types.BIGINT },
			{ "submissionTimestamp", Types.BIGINT },
			{ "pickupTimestamp", Types.BIGINT },
			{ "deliveryTimestamp", Types.BIGINT },
			{ "recipientSignature", Types.CLOB },
			{ "estimatedPickupTime", Types.BIGINT },
			{ "estimatedDeliveryTime", Types.BIGINT }
		};
	public static final String TABLE_SQL_CREATE = "create table bp_delivery (deliveryId LONG not null primary key,deliveryCode VARCHAR(75) null,trackingCode VARCHAR(75) null,senderAddress VARCHAR(75) null,senderAdditionalInfo VARCHAR(75) null,senderEmail VARCHAR(75) null,recipientAddress VARCHAR(75) null,recipientAdditionalInfo VARCHAR(75) null,recipientEmail VARCHAR(75) null,state_ INTEGER,agentId LONG,submissionTimestamp LONG,pickupTimestamp LONG,deliveryTimestamp LONG,recipientSignature TEXT null,estimatedPickupTime LONG,estimatedDeliveryTime LONG)";
	public static final String TABLE_SQL_DROP = "drop table bp_delivery";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.mad.bikepony.model.Delivery"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.mad.bikepony.model.Delivery"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.column.bitmask.enabled.com.mad.bikepony.model.Delivery"),
			true);
	public static long AGENTID_COLUMN_BITMASK = 1L;
	public static long DELIVERYCODE_COLUMN_BITMASK = 2L;
	public static long DELIVERYID_COLUMN_BITMASK = 4L;
	public static long STATE_COLUMN_BITMASK = 8L;
	public static long TRACKINGCODE_COLUMN_BITMASK = 16L;

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static Delivery toModel(DeliverySoap soapModel) {
		if (soapModel == null) {
			return null;
		}

		Delivery model = new DeliveryImpl();

		model.setDeliveryId(soapModel.getDeliveryId());
		model.setDeliveryCode(soapModel.getDeliveryCode());
		model.setTrackingCode(soapModel.getTrackingCode());
		model.setSenderAddress(soapModel.getSenderAddress());
		model.setSenderAdditionalInfo(soapModel.getSenderAdditionalInfo());
		model.setSenderEmail(soapModel.getSenderEmail());
		model.setRecipientAddress(soapModel.getRecipientAddress());
		model.setRecipientAdditionalInfo(soapModel.getRecipientAdditionalInfo());
		model.setRecipientEmail(soapModel.getRecipientEmail());
		model.setState(soapModel.getState());
		model.setAgentId(soapModel.getAgentId());
		model.setSubmissionTimestamp(soapModel.getSubmissionTimestamp());
		model.setPickupTimestamp(soapModel.getPickupTimestamp());
		model.setDeliveryTimestamp(soapModel.getDeliveryTimestamp());
		model.setRecipientSignature(soapModel.getRecipientSignature());
		model.setEstimatedPickupTime(soapModel.getEstimatedPickupTime());
		model.setEstimatedDeliveryTime(soapModel.getEstimatedDeliveryTime());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<Delivery> toModels(DeliverySoap[] soapModels) {
		if (soapModels == null) {
			return null;
		}

		List<Delivery> models = new ArrayList<Delivery>(soapModels.length);

		for (DeliverySoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.mad.bikepony.model.Delivery"));

	public DeliveryModelImpl() {
	}

	public long getPrimaryKey() {
		return _deliveryId;
	}

	public void setPrimaryKey(long primaryKey) {
		setDeliveryId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_deliveryId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return Delivery.class;
	}

	public String getModelClassName() {
		return Delivery.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("deliveryId", getDeliveryId());
		attributes.put("deliveryCode", getDeliveryCode());
		attributes.put("trackingCode", getTrackingCode());
		attributes.put("senderAddress", getSenderAddress());
		attributes.put("senderAdditionalInfo", getSenderAdditionalInfo());
		attributes.put("senderEmail", getSenderEmail());
		attributes.put("recipientAddress", getRecipientAddress());
		attributes.put("recipientAdditionalInfo", getRecipientAdditionalInfo());
		attributes.put("recipientEmail", getRecipientEmail());
		attributes.put("state", getState());
		attributes.put("agentId", getAgentId());
		attributes.put("submissionTimestamp", getSubmissionTimestamp());
		attributes.put("pickupTimestamp", getPickupTimestamp());
		attributes.put("deliveryTimestamp", getDeliveryTimestamp());
		attributes.put("recipientSignature", getRecipientSignature());
		attributes.put("estimatedPickupTime", getEstimatedPickupTime());
		attributes.put("estimatedDeliveryTime", getEstimatedDeliveryTime());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long deliveryId = (Long)attributes.get("deliveryId");

		if (deliveryId != null) {
			setDeliveryId(deliveryId);
		}

		String deliveryCode = (String)attributes.get("deliveryCode");

		if (deliveryCode != null) {
			setDeliveryCode(deliveryCode);
		}

		String trackingCode = (String)attributes.get("trackingCode");

		if (trackingCode != null) {
			setTrackingCode(trackingCode);
		}

		String senderAddress = (String)attributes.get("senderAddress");

		if (senderAddress != null) {
			setSenderAddress(senderAddress);
		}

		String senderAdditionalInfo = (String)attributes.get(
				"senderAdditionalInfo");

		if (senderAdditionalInfo != null) {
			setSenderAdditionalInfo(senderAdditionalInfo);
		}

		String senderEmail = (String)attributes.get("senderEmail");

		if (senderEmail != null) {
			setSenderEmail(senderEmail);
		}

		String recipientAddress = (String)attributes.get("recipientAddress");

		if (recipientAddress != null) {
			setRecipientAddress(recipientAddress);
		}

		String recipientAdditionalInfo = (String)attributes.get(
				"recipientAdditionalInfo");

		if (recipientAdditionalInfo != null) {
			setRecipientAdditionalInfo(recipientAdditionalInfo);
		}

		String recipientEmail = (String)attributes.get("recipientEmail");

		if (recipientEmail != null) {
			setRecipientEmail(recipientEmail);
		}

		Integer state = (Integer)attributes.get("state");

		if (state != null) {
			setState(state);
		}

		Long agentId = (Long)attributes.get("agentId");

		if (agentId != null) {
			setAgentId(agentId);
		}

		Long submissionTimestamp = (Long)attributes.get("submissionTimestamp");

		if (submissionTimestamp != null) {
			setSubmissionTimestamp(submissionTimestamp);
		}

		Long pickupTimestamp = (Long)attributes.get("pickupTimestamp");

		if (pickupTimestamp != null) {
			setPickupTimestamp(pickupTimestamp);
		}

		Long deliveryTimestamp = (Long)attributes.get("deliveryTimestamp");

		if (deliveryTimestamp != null) {
			setDeliveryTimestamp(deliveryTimestamp);
		}

		String recipientSignature = (String)attributes.get("recipientSignature");

		if (recipientSignature != null) {
			setRecipientSignature(recipientSignature);
		}

		Long estimatedPickupTime = (Long)attributes.get("estimatedPickupTime");

		if (estimatedPickupTime != null) {
			setEstimatedPickupTime(estimatedPickupTime);
		}

		Long estimatedDeliveryTime = (Long)attributes.get(
				"estimatedDeliveryTime");

		if (estimatedDeliveryTime != null) {
			setEstimatedDeliveryTime(estimatedDeliveryTime);
		}
	}

	@JSON
	public long getDeliveryId() {
		return _deliveryId;
	}

	public void setDeliveryId(long deliveryId) {
		_columnBitmask |= DELIVERYID_COLUMN_BITMASK;

		if (!_setOriginalDeliveryId) {
			_setOriginalDeliveryId = true;

			_originalDeliveryId = _deliveryId;
		}

		_deliveryId = deliveryId;
	}

	public long getOriginalDeliveryId() {
		return _originalDeliveryId;
	}

	@JSON
	public String getDeliveryCode() {
		if (_deliveryCode == null) {
			return StringPool.BLANK;
		}
		else {
			return _deliveryCode;
		}
	}

	public void setDeliveryCode(String deliveryCode) {
		_columnBitmask |= DELIVERYCODE_COLUMN_BITMASK;

		if (_originalDeliveryCode == null) {
			_originalDeliveryCode = _deliveryCode;
		}

		_deliveryCode = deliveryCode;
	}

	public String getOriginalDeliveryCode() {
		return GetterUtil.getString(_originalDeliveryCode);
	}

	@JSON
	public String getTrackingCode() {
		if (_trackingCode == null) {
			return StringPool.BLANK;
		}
		else {
			return _trackingCode;
		}
	}

	public void setTrackingCode(String trackingCode) {
		_columnBitmask |= TRACKINGCODE_COLUMN_BITMASK;

		if (_originalTrackingCode == null) {
			_originalTrackingCode = _trackingCode;
		}

		_trackingCode = trackingCode;
	}

	public String getOriginalTrackingCode() {
		return GetterUtil.getString(_originalTrackingCode);
	}

	@JSON
	public String getSenderAddress() {
		if (_senderAddress == null) {
			return StringPool.BLANK;
		}
		else {
			return _senderAddress;
		}
	}

	public void setSenderAddress(String senderAddress) {
		_senderAddress = senderAddress;
	}

	@JSON
	public String getSenderAdditionalInfo() {
		if (_senderAdditionalInfo == null) {
			return StringPool.BLANK;
		}
		else {
			return _senderAdditionalInfo;
		}
	}

	public void setSenderAdditionalInfo(String senderAdditionalInfo) {
		_senderAdditionalInfo = senderAdditionalInfo;
	}

	@JSON
	public String getSenderEmail() {
		if (_senderEmail == null) {
			return StringPool.BLANK;
		}
		else {
			return _senderEmail;
		}
	}

	public void setSenderEmail(String senderEmail) {
		_senderEmail = senderEmail;
	}

	@JSON
	public String getRecipientAddress() {
		if (_recipientAddress == null) {
			return StringPool.BLANK;
		}
		else {
			return _recipientAddress;
		}
	}

	public void setRecipientAddress(String recipientAddress) {
		_recipientAddress = recipientAddress;
	}

	@JSON
	public String getRecipientAdditionalInfo() {
		if (_recipientAdditionalInfo == null) {
			return StringPool.BLANK;
		}
		else {
			return _recipientAdditionalInfo;
		}
	}

	public void setRecipientAdditionalInfo(String recipientAdditionalInfo) {
		_recipientAdditionalInfo = recipientAdditionalInfo;
	}

	@JSON
	public String getRecipientEmail() {
		if (_recipientEmail == null) {
			return StringPool.BLANK;
		}
		else {
			return _recipientEmail;
		}
	}

	public void setRecipientEmail(String recipientEmail) {
		_recipientEmail = recipientEmail;
	}

	@JSON
	public int getState() {
		return _state;
	}

	public void setState(int state) {
		_columnBitmask |= STATE_COLUMN_BITMASK;

		if (!_setOriginalState) {
			_setOriginalState = true;

			_originalState = _state;
		}

		_state = state;
	}

	public int getOriginalState() {
		return _originalState;
	}

	@JSON
	public long getAgentId() {
		return _agentId;
	}

	public void setAgentId(long agentId) {
		_columnBitmask |= AGENTID_COLUMN_BITMASK;

		if (!_setOriginalAgentId) {
			_setOriginalAgentId = true;

			_originalAgentId = _agentId;
		}

		_agentId = agentId;
	}

	public long getOriginalAgentId() {
		return _originalAgentId;
	}

	@JSON
	public long getSubmissionTimestamp() {
		return _submissionTimestamp;
	}

	public void setSubmissionTimestamp(long submissionTimestamp) {
		_submissionTimestamp = submissionTimestamp;
	}

	@JSON
	public long getPickupTimestamp() {
		return _pickupTimestamp;
	}

	public void setPickupTimestamp(long pickupTimestamp) {
		_pickupTimestamp = pickupTimestamp;
	}

	@JSON
	public long getDeliveryTimestamp() {
		return _deliveryTimestamp;
	}

	public void setDeliveryTimestamp(long deliveryTimestamp) {
		_deliveryTimestamp = deliveryTimestamp;
	}

	@JSON
	public String getRecipientSignature() {
		if (_recipientSignature == null) {
			return StringPool.BLANK;
		}
		else {
			return _recipientSignature;
		}
	}

	public void setRecipientSignature(String recipientSignature) {
		_recipientSignature = recipientSignature;
	}

	@JSON
	public long getEstimatedPickupTime() {
		return _estimatedPickupTime;
	}

	public void setEstimatedPickupTime(long estimatedPickupTime) {
		_estimatedPickupTime = estimatedPickupTime;
	}

	@JSON
	public long getEstimatedDeliveryTime() {
		return _estimatedDeliveryTime;
	}

	public void setEstimatedDeliveryTime(long estimatedDeliveryTime) {
		_estimatedDeliveryTime = estimatedDeliveryTime;
	}

	public long getColumnBitmask() {
		return _columnBitmask;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			Delivery.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public Delivery toEscapedModel() {
		if (_escapedModelProxy == null) {
			_escapedModelProxy = (Delivery)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelProxyInterfaces,
					new AutoEscapeBeanHandler(this));
		}

		return _escapedModelProxy;
	}

	@Override
	public Object clone() {
		DeliveryImpl deliveryImpl = new DeliveryImpl();

		deliveryImpl.setDeliveryId(getDeliveryId());
		deliveryImpl.setDeliveryCode(getDeliveryCode());
		deliveryImpl.setTrackingCode(getTrackingCode());
		deliveryImpl.setSenderAddress(getSenderAddress());
		deliveryImpl.setSenderAdditionalInfo(getSenderAdditionalInfo());
		deliveryImpl.setSenderEmail(getSenderEmail());
		deliveryImpl.setRecipientAddress(getRecipientAddress());
		deliveryImpl.setRecipientAdditionalInfo(getRecipientAdditionalInfo());
		deliveryImpl.setRecipientEmail(getRecipientEmail());
		deliveryImpl.setState(getState());
		deliveryImpl.setAgentId(getAgentId());
		deliveryImpl.setSubmissionTimestamp(getSubmissionTimestamp());
		deliveryImpl.setPickupTimestamp(getPickupTimestamp());
		deliveryImpl.setDeliveryTimestamp(getDeliveryTimestamp());
		deliveryImpl.setRecipientSignature(getRecipientSignature());
		deliveryImpl.setEstimatedPickupTime(getEstimatedPickupTime());
		deliveryImpl.setEstimatedDeliveryTime(getEstimatedDeliveryTime());

		deliveryImpl.resetOriginalValues();

		return deliveryImpl;
	}

	public int compareTo(Delivery delivery) {
		long primaryKey = delivery.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		Delivery delivery = null;

		try {
			delivery = (Delivery)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = delivery.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
		DeliveryModelImpl deliveryModelImpl = this;

		deliveryModelImpl._originalDeliveryId = deliveryModelImpl._deliveryId;

		deliveryModelImpl._setOriginalDeliveryId = false;

		deliveryModelImpl._originalDeliveryCode = deliveryModelImpl._deliveryCode;

		deliveryModelImpl._originalTrackingCode = deliveryModelImpl._trackingCode;

		deliveryModelImpl._originalState = deliveryModelImpl._state;

		deliveryModelImpl._setOriginalState = false;

		deliveryModelImpl._originalAgentId = deliveryModelImpl._agentId;

		deliveryModelImpl._setOriginalAgentId = false;

		deliveryModelImpl._columnBitmask = 0;
	}

	@Override
	public CacheModel<Delivery> toCacheModel() {
		DeliveryCacheModel deliveryCacheModel = new DeliveryCacheModel();

		deliveryCacheModel.deliveryId = getDeliveryId();

		deliveryCacheModel.deliveryCode = getDeliveryCode();

		String deliveryCode = deliveryCacheModel.deliveryCode;

		if ((deliveryCode != null) && (deliveryCode.length() == 0)) {
			deliveryCacheModel.deliveryCode = null;
		}

		deliveryCacheModel.trackingCode = getTrackingCode();

		String trackingCode = deliveryCacheModel.trackingCode;

		if ((trackingCode != null) && (trackingCode.length() == 0)) {
			deliveryCacheModel.trackingCode = null;
		}

		deliveryCacheModel.senderAddress = getSenderAddress();

		String senderAddress = deliveryCacheModel.senderAddress;

		if ((senderAddress != null) && (senderAddress.length() == 0)) {
			deliveryCacheModel.senderAddress = null;
		}

		deliveryCacheModel.senderAdditionalInfo = getSenderAdditionalInfo();

		String senderAdditionalInfo = deliveryCacheModel.senderAdditionalInfo;

		if ((senderAdditionalInfo != null) &&
				(senderAdditionalInfo.length() == 0)) {
			deliveryCacheModel.senderAdditionalInfo = null;
		}

		deliveryCacheModel.senderEmail = getSenderEmail();

		String senderEmail = deliveryCacheModel.senderEmail;

		if ((senderEmail != null) && (senderEmail.length() == 0)) {
			deliveryCacheModel.senderEmail = null;
		}

		deliveryCacheModel.recipientAddress = getRecipientAddress();

		String recipientAddress = deliveryCacheModel.recipientAddress;

		if ((recipientAddress != null) && (recipientAddress.length() == 0)) {
			deliveryCacheModel.recipientAddress = null;
		}

		deliveryCacheModel.recipientAdditionalInfo = getRecipientAdditionalInfo();

		String recipientAdditionalInfo = deliveryCacheModel.recipientAdditionalInfo;

		if ((recipientAdditionalInfo != null) &&
				(recipientAdditionalInfo.length() == 0)) {
			deliveryCacheModel.recipientAdditionalInfo = null;
		}

		deliveryCacheModel.recipientEmail = getRecipientEmail();

		String recipientEmail = deliveryCacheModel.recipientEmail;

		if ((recipientEmail != null) && (recipientEmail.length() == 0)) {
			deliveryCacheModel.recipientEmail = null;
		}

		deliveryCacheModel.state = getState();

		deliveryCacheModel.agentId = getAgentId();

		deliveryCacheModel.submissionTimestamp = getSubmissionTimestamp();

		deliveryCacheModel.pickupTimestamp = getPickupTimestamp();

		deliveryCacheModel.deliveryTimestamp = getDeliveryTimestamp();

		deliveryCacheModel.recipientSignature = getRecipientSignature();

		String recipientSignature = deliveryCacheModel.recipientSignature;

		if ((recipientSignature != null) && (recipientSignature.length() == 0)) {
			deliveryCacheModel.recipientSignature = null;
		}

		deliveryCacheModel.estimatedPickupTime = getEstimatedPickupTime();

		deliveryCacheModel.estimatedDeliveryTime = getEstimatedDeliveryTime();

		return deliveryCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(35);

		sb.append("{deliveryId=");
		sb.append(getDeliveryId());
		sb.append(", deliveryCode=");
		sb.append(getDeliveryCode());
		sb.append(", trackingCode=");
		sb.append(getTrackingCode());
		sb.append(", senderAddress=");
		sb.append(getSenderAddress());
		sb.append(", senderAdditionalInfo=");
		sb.append(getSenderAdditionalInfo());
		sb.append(", senderEmail=");
		sb.append(getSenderEmail());
		sb.append(", recipientAddress=");
		sb.append(getRecipientAddress());
		sb.append(", recipientAdditionalInfo=");
		sb.append(getRecipientAdditionalInfo());
		sb.append(", recipientEmail=");
		sb.append(getRecipientEmail());
		sb.append(", state=");
		sb.append(getState());
		sb.append(", agentId=");
		sb.append(getAgentId());
		sb.append(", submissionTimestamp=");
		sb.append(getSubmissionTimestamp());
		sb.append(", pickupTimestamp=");
		sb.append(getPickupTimestamp());
		sb.append(", deliveryTimestamp=");
		sb.append(getDeliveryTimestamp());
		sb.append(", recipientSignature=");
		sb.append(getRecipientSignature());
		sb.append(", estimatedPickupTime=");
		sb.append(getEstimatedPickupTime());
		sb.append(", estimatedDeliveryTime=");
		sb.append(getEstimatedDeliveryTime());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(55);

		sb.append("<model><model-name>");
		sb.append("com.mad.bikepony.model.Delivery");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>deliveryId</column-name><column-value><![CDATA[");
		sb.append(getDeliveryId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>deliveryCode</column-name><column-value><![CDATA[");
		sb.append(getDeliveryCode());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>trackingCode</column-name><column-value><![CDATA[");
		sb.append(getTrackingCode());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>senderAddress</column-name><column-value><![CDATA[");
		sb.append(getSenderAddress());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>senderAdditionalInfo</column-name><column-value><![CDATA[");
		sb.append(getSenderAdditionalInfo());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>senderEmail</column-name><column-value><![CDATA[");
		sb.append(getSenderEmail());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>recipientAddress</column-name><column-value><![CDATA[");
		sb.append(getRecipientAddress());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>recipientAdditionalInfo</column-name><column-value><![CDATA[");
		sb.append(getRecipientAdditionalInfo());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>recipientEmail</column-name><column-value><![CDATA[");
		sb.append(getRecipientEmail());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>state</column-name><column-value><![CDATA[");
		sb.append(getState());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>agentId</column-name><column-value><![CDATA[");
		sb.append(getAgentId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>submissionTimestamp</column-name><column-value><![CDATA[");
		sb.append(getSubmissionTimestamp());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>pickupTimestamp</column-name><column-value><![CDATA[");
		sb.append(getPickupTimestamp());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>deliveryTimestamp</column-name><column-value><![CDATA[");
		sb.append(getDeliveryTimestamp());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>recipientSignature</column-name><column-value><![CDATA[");
		sb.append(getRecipientSignature());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>estimatedPickupTime</column-name><column-value><![CDATA[");
		sb.append(getEstimatedPickupTime());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>estimatedDeliveryTime</column-name><column-value><![CDATA[");
		sb.append(getEstimatedDeliveryTime());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = Delivery.class.getClassLoader();
	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
			Delivery.class
		};
	private long _deliveryId;
	private long _originalDeliveryId;
	private boolean _setOriginalDeliveryId;
	private String _deliveryCode;
	private String _originalDeliveryCode;
	private String _trackingCode;
	private String _originalTrackingCode;
	private String _senderAddress;
	private String _senderAdditionalInfo;
	private String _senderEmail;
	private String _recipientAddress;
	private String _recipientAdditionalInfo;
	private String _recipientEmail;
	private int _state;
	private int _originalState;
	private boolean _setOriginalState;
	private long _agentId;
	private long _originalAgentId;
	private boolean _setOriginalAgentId;
	private long _submissionTimestamp;
	private long _pickupTimestamp;
	private long _deliveryTimestamp;
	private String _recipientSignature;
	private long _estimatedPickupTime;
	private long _estimatedDeliveryTime;
	private long _columnBitmask;
	private Delivery _escapedModelProxy;
}